import React, { Component } from 'react';
// 导入路由 BrowserRouter重命名为Router
import {
  BrowserRouter as Router,
  Route,
  Switch,
  Redirect,
} from 'react-router-dom';

// 导入页面组件
import Login from './pages/Login';
import Layout from './pages/Layout/index';

// 配置路由规则
export default class App extends Component {
  render() {
    return (
      <Router>
        <div className="App">
          {/* 配置路由规则 Switch包住所有Route */}
          <Switch>
            <Redirect exact from="/" to="/layout"></Redirect>
            <Route path="/layout" component={Layout}></Route>
            <Route path="/login" component={Login}></Route>
          </Switch>
        </div>
      </Router>
    );
  }
}
